from handlers.requesthandler import RequestHandler
from model.video import Video
from google.appengine.api import images
from google.appengine.ext import db


from handlers.loginhandler import LoginRequired
from google.appengine.api import users
from google.appengine.ext import webapp



class AddVideo(RequestHandler):
    def post(self):
        video = Video(name=self.request.get('name'),
                    link=self.request.get('link'),
                    desc=self.request.get('desc'),    
                    cover=db.Blob(images.resize(self.request.get('cover'),32,32))
                    )
        video.put()        
        template_values = {
                           'video':video,
                           }
        self.render('addvideo.html', template_values);
